package com.rtx.wms.std.qc.service.impl;

import cn.hutool.core.util.IdUtil;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.rtx.api.annotation.DataSourceAnnotation;
import com.rtx.wms.std.qc.bean.ApiQc;
import com.rtx.wms.std.qc.bean.ApiQcDetail;
import com.rtx.wms.std.qc.bean.RtxQc;
import com.rtx.wms.std.qc.bean.RtxQcDetail;
import com.rtx.wms.std.qc.mapper.ApiQcMapper;
import com.rtx.wms.std.qc.mapper.RtxQcMapper;
import com.rtx.wms.std.qc.service.ApiQcDetailService;
import com.rtx.wms.std.qc.service.ApiQcService;
import com.rtx.wms.std.qc.service.RtxQcDetailService;
import com.rtx.wms.std.qc.service.RtxQcService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
public class RtxQcServiceImpl extends ServiceImpl<RtxQcMapper, RtxQc> implements RtxQcService {
	
	@Autowired
	RtxQcDetailService rtxQcDetailService;

	@Transactional
	@DataSourceAnnotation
	@Override
	public void insertRtxQcAndDetail(String datasourcekey,RtxQc o) {
		for(RtxQcDetail qd:o.getRtxQcDetailList()) {
			rtxQcDetailService.save(qd);
		}
		this.save(o);
	}
}
